/*
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
*/
#include<stdio.h>


void f(char src,char assist, char target, int n)
{
	if(n==1)
	{
		printf("%d:%c->%c\n",n,src,target);
	}
	else
	{
		f(src,target,assist,n-1);
		printf("%d:%c->%c\n",n,src,target);
		f(assist,src,target,n-1);
	}
}

int main(void)
{
	int n;
	scanf("%d",&n);
	f('A','B','C',n);
	return 0;
}
